<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vstaudio, vstaudiog</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vrandi.html" title="vrandi" />
    <link rel="next" href="vstbankload.html" title="vstbankload" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vstaudio, vstaudiog</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vrandi.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vstbankload.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="vstaudio"></a>
      <div class="titlepage"></div>
      <a id="IndexVstAudio" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vstaudio, vstaudiog</span>
        </h2>
        <p>vstaudio — VST audio output.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166096256"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">aout1,aout2 <span class="command"><strong>vstaudio</strong></span> instance, [ain1, ain2]</pre>
        <pre class="synopsis">aout1,aout2 <span class="command"><strong>vstaudiog</strong></span> instance, [ain1, ain2]</pre>
      </div>
      <div class="refsect1">
        <a id="idp166174000"></a>
        <h2>Description</h2>
        <p><span class="emphasis"><em>vstaudio</em></span> and <span class="emphasis"><em>vstaudiog</em></span>
      are used for sending and receiving audio from a VST plugin.</p>
        <p><span class="emphasis"><em>vstaudio</em></span> is used within an instrument
      definition that contains a <span class="emphasis"><em>vstmidiout</em></span> or
      <span class="emphasis"><em>vstnote</em></span> opcode. It outputs audio for only that
      one instrument. Any audio remaining in the plugin after the end of the
      note, for example a reverb tail, will be cut off and should be dealt
      with using a damping envelope.</p>
        <p><span class="emphasis"><em>vstaudiog</em></span> (vstaudio global) is used in a
      separate instrument to process audio from any number of VST notes or
      MIDI events that share the same VST plugin instance (instance). The
      <span class="emphasis"><em>vstaudiog</em></span> instrument must be numbered higher than
      all the instruments receiving notes or MIDI data, and the note
      controlling the vstplug instrument must have an indefinite duration,
      or at least a duration as long as the VST plugin is active.</p>
      </div>
      <div class="refsect1">
        <a id="idp166179760"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>instance</em></span> - the number which identifies the
      plugin, to be passed to other vst4cs opcodes.</p>
      </div>
      <div class="refsect1">
        <a id="idp166181424"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>aout1, aout2</em></span> - the audio output received from
      the plugin.</p>
        <p><span class="emphasis"><em>ain1, ain2</em></span> - the audio input sent to the
      plugin.</p>
      </div>
      <div class="refsect1">
        <a id="idp166183792"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the use of the <span class="emphasis"><em>vstaudio</em></span> opcode. It uses the file <a class="ulink" href="examples/vst4cs.csd" target="_top"><em class="citetitle">vst4cs.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp166186096"></a>
          <p class="title">
            <strong>Example 1021. Example of the <span class="emphasis"><em>vstaudio</em></span> opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Credits: Adapted by Michael Gogins </span>
<span class="comment">; from code by David Horowitz and Lian Cheung. </span>
<span class="comment">; The "--displays" option is required in order for </span>
<span class="comment">; the Pianoteq GUI to dispatch events and display properly.</span>
-m3 --displays -odac
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="ohdr">sr</span>     <span class="op">=</span> 44100
<span class="ohdr">ksmps</span>  <span class="op">=</span> 20
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
                <span class="comment">; Load the Pianoteq into memory.</span>
gipianoteq      <span class="opc">vstinit</span>         "C<span class="op">:</span>\\Program Files\\Steinberg\\VstPlugins\\Pianoteq 3.0 Trial\\Pianoteq30 Trial.dll", 1
                
                <span class="comment">; Print information about the Pianoteq, such as parameter names and numbers.</span>
                <span class="opc">vstinfo</span>         gipianoteq
                
                <span class="comment">; Open the Pianoteq's GUI.</span>
                <span class="opc">vstedit</span>         gipianoteq

                <span class="comment">; Send notes from the score to the Pianoteq.</span>
                <span class="oblock">instr</span> 1 
                <span class="comment">; MIDI channels are numbered starting at 0.</span>
                <span class="comment">; p3 always contains the duration of the note.</span>
                <span class="comment">; p4 contains the MIDI key number (pitch),</span>
                <span class="comment">; p5 contains the MIDI velocity number (loudness),</span>
imidichannel    <span class="opc">init</span>            0
                <span class="opc">vstnote</span>         gipianoteq, imidichannel, p4, p5, p3
                <span class="oblock">endin</span>

                <span class="comment">; Send parameter changes to the Pianoteq.</span>
                <span class="oblock">instr</span> 2 
                <span class="comment">; p4 is the parameter number.</span>
                <span class="comment">; p5 is the parameter value.</span>
                <span class="opc">vstparamset</span>     gipianoteq, p4, p5 
                <span class="oblock">endin</span>

                <span class="comment">; Send audio from the Pianoteq to the output.</span>
                <span class="oblock">instr</span> 3 
ablankinput     <span class="opc">init</span>            0
aleft, aright   <span class="opc">vstaudio</span>        gipianoteq, ablankinput, ablankinput
                <span class="opc">outs</span>            aleft, aright
                <span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; Turn on the instrument that receives audio from the Pianoteq indefinitely.</span>
<span class="stamnt">i</span> 3 0 -1
<span class="comment">; Send parameter changes to Pianoteq before sending any notes.</span>
<span class="comment">; NOTE: All parameters must be between 0.0 and 1.0.</span>
<span class="comment">; Length of piano strings:</span>
<span class="stamnt">i</span> 2 0 1 33 0.5
<span class="comment">; Hammer noise:</span>
<span class="stamnt">i</span> 2 0 1 25 0.1
<span class="comment">; Send a C major 7th arpeggio to the Pianoteq.</span>
<span class="stamnt">i</span> 1 1 10 60 76
<span class="stamnt">i</span> 1 2 10 64 73
<span class="stamnt">i</span> 1 3 10 67 70 
<span class="stamnt">i</span> 1 4 10 71 67
<span class="comment">; End the performance, leaving some time </span>
<span class="comment">; for the Pianoteq to finish sending out its audio,</span>
<span class="comment">; or for the user to play with the Pianoteq virtual keyboard.</span>
<span class="stamnt">e</span> 20
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166190816"></a>
        <h2>Credits</h2>
        <p>By: Andrés Cabrera and Michael Gogins</p>
        <p>Uses code from Hermann Seib's VSTHost and Thomas Grill's vst~
      object.</p>
        <p>VST is a trademark of Steinberg Media Technologies GmbH.
      VST Plug-In Technology by Steinberg.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vrandi.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="vstbankload.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vrandi </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vstbankload</td>
        </tr>
      </table>
    </div>
  </body>
</html>
